<?php
/**
 * 留言板
 */

namespace app\admin\model;


use app\common\model\Model;

class BulletinBoard extends Model
{

    const TABLE_NAME = 'bulletin_board';
    const CACHE_EXPIRE_LEVEL = self::CACHE_EXPIRE_LEVEL_4;

    protected $name = self::TABLE_NAME;

    public static function getListQuery($keyword='',$search_type='')
    {
        $query = self::commonQuery(self::TABLE_NAME);
        if($keyword)
        {
            if($search_type == 'real_name')
            {
                $query->where(['record_name'=>['like','%'.$keyword.'%']]);

            }
            if($search_type == 'email'){
                $query->where(['record_email'=>['like','%'.$keyword.'%']]);

            }
        }

        return $query;
    }
    public static function handleInfo($info)
    {
        $info['record_time']=date('Y-m-d H:i:s',$info['record_time']);
        return $info;
    }
}